Skip to content

fix shadow play: only use ahead extension set per direction#21

Merged
andy-k merged 1 commit intomainfrom
fix-shadow-extension-sets
Mar 30, 2026
Merged

fix shadow play: only use ahead extension set per direction#21
andy-k merged 1 commit intomainfrom
fix-shadow-extension-sets

Conversation

@andy-k
Copy link
Copy Markdown
Owner

@andy-k andy-k commented Mar 30, 2026

Summary

Fixes a correctness bug introduced in #15 (extension sets).

Shadow play was ANDing both left and right extension sets at every position. The "behind" extension set can be more restrictive than the GADDAG allows (it doesn't account for rack tiles placed during word generation), making the upper bound too tight and potentially missing valid moves.

Fix: use only the "ahead" extension set per shadow direction — left_extension_strip for shadow_play_right, right_extension_strip for shadow_play_left. Matches what word generation already does.

Test plan

  • debug_assert no longer fires (ran 60s in debug mode)
  • movegen baseline: tie-breaking order change only, same move sets
  • cargo fmt, clippy, build pass

Shadow play was ANDing both left and right extension sets at
every position. The "behind" extension set (based on board tiles
already traversed) can be more restrictive than the GADDAG
allows, because the extension set doesn't account for rack tiles
placed during word generation. This made the shadow play upper
bound too tight, potentially missing valid moves.

Fix: shadow_play_right uses only left_extension_strip (ahead).
     shadow_play_left uses only right_extension_strip (ahead).
Word generation already uses one extension set per direction.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@andy-k andy-k merged commit 67754e0 into main Mar 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant